package com.didispace.chapter36.entity;

import com.didispace.chapter36.vo.UserVO;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Date;


@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@AutoMapper(target = UserVO.class, reverseConvertGenerate = false)
public class User {
    @AutoMapping(target = "userId")
    private Long id;
    @AutoMapping(target = "userName")
    private String name;
    @AutoMapping(target = "userAge")
    private Integer age;
    @AutoMapping(target = "userSex")
    private String sex;
    @AutoMapping(target = "userCreatedAt")
    private LocalDateTime createdAt;
    @AutoMapping(target = "birth", dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date birth;

    public User(String name, Integer age) {
        this.name = name;
        this.age = age;
    }
}
